package com.yulongtian.oneProblemEveryDay.month202212;

/**
 * https://leetcode.cn/problems/minimum-elements-to-add-to-form-a-given-sum/
 *
 * @author yulongTian
 * @create 2022-12-16 10:26
 */
public class Test10 {
    public static void main(String[] args) {

    }

    public int minElements(int[] nums, int limit, int goal) {
        long sum = 0;
        for (int num : nums) {
            sum += num;
        }
        return (int) Math.ceil(Math.abs((double) sum - goal) / limit);
    }

}
